package com.example.flowerback.controller;

import com.example.flowerback.mode.Login;
import com.example.flowerback.mode.RegisterUser;
import com.example.flowerback.service.loginInOutService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/loginInOut")
@Slf4j
public class GoOutController {
    @Autowired //从bean里面拿到UserMapper接口，拿到里面的属性内容
    loginInOutService loginInOutService;

    @PostMapping("/register")
    public String register(@RequestBody RegisterUser user){
        return loginInOutService.registerUser(user);
    }
    @PostMapping("/login")
    public String login(@RequestBody Login user){
        return loginInOutService.login(user);
    }
}
